package sskj.regulatory.presentation.screen.qrlogin

import isskj.regulatory.presentation.base_mvp.api.ApiPresenter
import javax.inject.Inject

class QrLoginPresenter @Inject constructor()
    : ApiPresenter<QrLoginContract.View>(), QrLoginContract.Presenter {

    override fun qrLogin(qrCode: String) {
        view.showLoading()
        fetch(userInteractor.xmbDoQrLogin(qrCode)) {
            view.hideLoading()
            when(it.success){
                true->view.loginOk()
                else->view.showError("")
            }
        }
    }

    override fun onRequestError(errorCode: String?, errorMessage: String?) {
        super.onRequestError(errorCode, errorMessage)
        view.hideLoading()
    }
}